package com.seveneight.baijiesteward.utils;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;

@SuppressLint({"ShowToast", "SetJavaScriptEnabled", "SdCardPath",
        "JavascriptInterface"})
public class UIHeperUtil {

    private static UIHeperUtil uiHeperUtil;

    public synchronized static UIHeperUtil getInstance() {
        if (uiHeperUtil == null) {
            uiHeperUtil = new UIHeperUtil();
        }
        return uiHeperUtil;
    }
    /**
     * 返回屏幕宽度
     *
     * @param context
     * @return
     */
    public static int getWindowWidth(Context context) {
        DisplayMetrics dm = new DisplayMetrics();
        ((Activity) context).getWindowManager().getDefaultDisplay()
                .getMetrics(dm);
        return dm.widthPixels;
    }

    /**
     * 返回屏幕高度
     *
     * @param context
     * @return
     */
    public static int getWindowHeight(Context context) {
        DisplayMetrics dm = new DisplayMetrics();
        ((Activity) context).getWindowManager().getDefaultDisplay()
                .getMetrics(dm);
        return dm.heightPixels;
    }

}
